/*
 * SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

@import (reference) '../../customize/src/less2/include/sidebar-layout.less';
@import (reference) "../../customize/src/less2/include/limit-bar.less";
@import (reference) "../../customize/src/less2/include/creation.less";
@import (reference) '../../customize/src/less2/include/framework.less';
@import (reference) '../../customize/src/less2/include/export.less';
@import (reference) '../../customize/src/less2/include/badges.less';
@import (reference) '../../customize/src/less2/include/avatar.less';
@import (reference) "../../customize/src/less2/include/markdown.less";

&.cp-app-settings {
    .framework_min_main();
    .sidebar-layout_main();
    .limit-bar_main();
    .creation_main();

    display: flex;
    flex-flow: column;
    font: @colortheme_app-font;

    .cp-sidebarlayout-element {
        max-width: 650px;
    }
    .cp-spinner, .cp-ok {
        svg {
            width: 1.2rem;
        }
    }
    .cp-checkmark.noTitle, .cp-sidebarlayout-input-block {
        svg {
            margin-left: @variables_icon_margin;
        }
    }
    .cp-spinner, .cp-ok{
        display: inline-flex;
        align-items: center;
        justify-content: center;
        vertical-align: middle;
    }
    .cp-spinner svg {
        animation: spin 10s linear infinite;
    }

    div.alert {
        font-size: @colortheme_app-font-size;
        padding: 10px;
    }

    .export_main();

    .alertify {
        nav {
            display: flex;
            justify-content: flex-end;
            align-items: flex-end;
            .btn-confirm {
                white-space: normal;
            }
        }
    }

    #cp-sidebarlayout-container {
        #cp-sidebarlayout-rightside {
            input, button, span[tabindex="0"] {
                &:focus-visible {
                    outline: @variables_focus_style;
                }
            }
            input[type="checkbox"] {
                vertical-align: middle;
                margin-right: 5px;
            }
            .cp-settings-cursor-color-picker {
                border-radius: @variables_radius;
                display: inline-block;
                vertical-align: middle;
                height: 25px;
                width: 70px;
                margin-right: 10px;
                cursor: pointer;
                border: 1px solid black;
            }
            .cp-settings-language-selector {
                #cp-language-selector {
                    display: inline;
                }
                button.btn {
                    width: @sidebar_block-width;
                    max-width: 100%;
                    margin: 0 !important;
                }
            }
            .cp-sidebarlayout-input-block {
                position: relative;
                input {
                    border-top-right-radius: 0;
                    border-bottom-right-radius: 0;
                    padding: 5px;
                    padding-left: 15px;
                    &[type="number"] {
                        height: @variables_input-height + 2px; // to avoid cropped numbers
                        border-right: 1px solid #adadad;
                    }
                    &[type="checkbox"] {
                        margin-right: 100%;
                    }
                }
                & > .cp-spinner,
                & > .cp-ok {
                    position: absolute;
                    right: -16px;
                    top: 50%;
                    transform: translateY(-50%);
                    margin-right: -16px;
                }
            }
            .cp-settings-info-block {
                [type="text"] {
                    width: @sidebar_block-width;
                    max-width: 100%;
                }
            }

            .cp-settings-radio-container {
                display: flex;
                align-items: center;
                flex-wrap: wrap;
                label {
                    padding-right: 1rem;
                    padding-bottom:0.5rem;
                }
                svg {
                    margin: 0 0 @variables_icon_margin;
                }
            }

            .cp-password-container {
                .cp-password-input{
                    margin-top:0.5rem;
                }
                [type="password"], [type="text"] {
                    //width: @sidebar_block-width;
                    flex: unset;
                }
                button {
                    margin-top:0;
                    margin-left: 10px;
                }
                .cp-password-reveal {
                    margin-left: 0.5rem;
                    border-radius:@variables_radius;
                }
            }
            nav {
                display: flex;
                justify-content: center;
                align-items: flex-end;
            }
            @media (max-width: 840px) {

                .cp-password-container {
                    button {
                        //margin-top: 10px;
                        margin-left: 0;
                    }
                }
            }
            .cp-settings-drive-backup {
                button {
                    margin-right: 5px;
                }
            }
            .cp-settings-mfa {
                .cp-settings-qr {
                    img {
                        border: 10px solid white;
                        border-radius: 10px;
                    }
                    margin: 10px 20px 20px 0;
                }
                @media(max-width:750px){
                    .cp-settings-qr {
                        img {
                            max-width:80%;
                        }

                        margin: 0 0 1rem;
                    }
                }
            }
            .cp-settings-mfa-hint {
                color: @cp_sidebar-hint;
            }
            .cp-settings-mfa-status {
                margin: 1em 0;
                display: inline-flex;
                align-items: center;
            }
            .cp-settings-safe-links {
                svg {
                    margin: 0;
                    vertical-align: middle;
                    width: 1rem;
                }
            }
            .cp-settings-mfa {
                .cp-password-container {
                    flex-wrap: wrap;
                    gap:0.5rem;

                    justify-content:flex-start;
                    input {
                        flex-shrink: 1;
                        max-width: 400px;
                    }
                    label {
                        width: 100%;
                        font-weight: unset;
                        margin-bottom: 5px;
                    }
                    button {
                        svg {
                            margin-right: @variables_icon_margin
                        }
                    }
                }
                .cp-settings-qr-container {
                    display: flex;
                    align-items: center;
                    .cp-settings-qr-code {
                        input {
                            max-width: 250px;
                        }
                        button {
                            margin-top: 10px;
                        }
                    }
                    .cp-settings-qr-code,.cp-button-confirm{
                        display:flex;
                        flex-direction:column;
                        button{
                            margin-top:1.5rem;
                            margin-bottom:1.5rem;
                        }
                    }
                }
                @media(max-width:750px){
                    .cp-settings-qr-container {
                        margin-top:1rem;
                    }
                }
            }
            .cp-settings-badges {
                display: flex;
                flex-flow: column;
                align-items: flex-start;
                .cp-settings-badges-list {
                    display: flex;
                    align-items: center;
                    font-size: 24px;
                    gap: 0.5rem;
                    margin-top: 10px;
                    .badges_main(40px);
                    span {
                        cursor: pointer;
                        &:focus-visible {
                            outline: @variables_focus_style;
                        }
                    }
                }
            }
            .cp-settings-profile-avatar {
                .cp-settings-avatar-container {
                    width: 300px;
                    margin-bottom: 1.5rem;
                    border-radius: 10px;
                }
                .cp-avatar {
                    box-sizing: content-box;
                    .avatar_main(300px);
                    display: flex;
                    text-align: center;
                    border-radius: 4px;
                    overflow: visible;
                    position: relative;
                    span.cp-badge {
                        border-width: 3px;
                    }
                    .cp-settings-avatar-delete {
                        right: 0;
                        top: 0;
                        position: absolute;
                        opacity: 1;
                        &:hover {
                            opacity: 0.7;
                        }
                        svg {
                            margin: 0;
                        }
                    }
                }
                img {
                    max-width: 100%;
                    max-height: 100%;
                    vertical-align: top;
                    border-radius: @variables_radius_L;
                }
                .cp-avatar-default {
                    border-radius: @variables_radius_L;
                }
                media-tag {
                    height: 100%;
                    width: 100%;
                    display: inline-flex;
                    justify-content: center;
                    align-items: center;
                    img {
                        min-width: 100%;
                        min-height: 100%;
                        max-width: none;
                        max-height: none;
                        flex: 1;
                    }
                }
                button {
                    min-width: 40px;
                    height: 40px;
                    margin: 5px !important;
                }
            }
            .cp-settings-profile-description {
                width: 40rem;
                max-width: 100%;
                .cp-labelled-input {
                    max-width: 100% !important;
                    width: 100% !important;
                }
                textarea, .CodeMirror {
                    height: 175px;
                    border-radius: 10px;
                }
                .CodeMirror {
                    font-family: monospace;
                    font-size: 16px;
                    line-height: initial;
                    max-width: 40rem;
                    border: 1px solid fade(@cryptpad_text_col, 50%);
                    margin: 5px 0;
                    pre {
                        margin: 0;
                        font-family: inherit;
                        font-size: inherit;
                        line-height: inherit;
                    }
                    * {
                        box-sizing: content-box;
                    }
                }
                .cp-markdown-toggle-button {
                    .markdown-toolbar-button-style();
                }
            }
        }
    }

    .cp-app-settings-delete-alert {
        pre { color: inherit; }
    }
}

